package cn.nnxy.zentao.controller;

import cn.nnxy.zentao.domain.List1User;
import cn.nnxy.zentao.service.List1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("back")
public class UpdateController {


    @Autowired
    private List1 list1;
    @GetMapping("edit")
    public String  addUser(Integer id, Model model){
        List1User user = list1.queryUpdate(id);
        model.addAttribute("user",user);
        return "update";
    }

    @PostMapping("update")//修改
    public String  UpdateUser(List1User user){
        list1.queryUpdate2(user);
        return "redirect:/back/user/userList";
    }
}
